﻿ 
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
 
<title>jb-aptech毕业设计项目</TITLE>
<meta name="renderer" content="ie-comp">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../../css/style.css" rel="stylesheet" type="text/css">
	<script src="../../js/vue.js"></script>
	<script src="../../js/jquery/jquery-1.5.2.min.js"></script>
<script src="script/common.js"></script>
<script src="script/validate.js"></script>
</head>
  	<script type="text/javascript">
  		function myAdd(){
  			document.sysUserForm.submit();
  		}
  	</script>
  <body>
  <div id="app">
   	<div class="page_title">权限管理 > 用户管理 > 添加系统用户</div>

   		<input type="hidden" name="method" value="addSysUser">
	   	<div class="button_bar">
	   		<button class="common_button" onclick="help('');">帮助</button>
	   		<button class="common_button" onclick="back();">返回</button>
			<button class="common_button" @click="add">保存</button>
	   	</div>
	   	<table class="query_form_table">
	   		<tr>
	   			<th>编号</th>
	   			<td>
	   				<input type="text" id="bh"/>
	   			</td>
	   			<th>用户名</th>
	   			<td>
	   				<input type="text" name="sysUser.usrName" size="20" value="" id="yhm">
	   			</td>
	   		</tr>
	   		<tr>
	   			<th>密码</th>
	   			<td>
	   				<input type="password" name="sysUser.usrPassword" size="20" value="" id="mm">
	   			</td>
	   			<th>
	   				状态
	   			</th>
	   			<td>
	   				正常
	   				<input type="hidden" name="sysUser.usrFlag" value="1" id="zt">
	   			</td>
	   		</tr>
	   		<tr>
	   			<th>角色</th>
	   			<td>
	   				未指派
					<input type="hidden" name="sysUser.usrFlag" id="js" value="0">
	   			</td>
	   		</tr>
	   	</table>
	   	<script>
				build_validate("sysUser.usrName","用户名不能为空","Limit","1","50");
				build_validate("sysUser.usrPassword","密码不能为空","Limit","1","50");
		</script>
  </div>
  </body>
<script>
	const  app=new Vue({
		el:"#app",
		data:{
			sum:[],
			sums:{
				right_code:"",
			},
		},methods:{
			add(){
				let bh = $("#bh").val();
				let yhm = $("#yhm").val();
				let mm = $("#mm").val();
				let zt = $("#zt").val();
				let js = $("#js").val();
				$.post("/SysUser/save", {"usr_id":bh,"usr_name":yhm,"usr_password":mm,"usr_flag":zt,"usr_role_id":js}, json => {
					if (json.message == "OK") {
						alert("保存成功");
						location.href = "list.html";
					} else {
						alert("保存失败");
						location.href = "list.html";
					}
				})
			}
		},mounted(){
			let ser=new URLSearchParams(location.search).get("right_code");
			this.sums.right_code=ser;

			this.load();
		}
	});
</script>
</html>
